package com.fqy.thread02.procon01;

/**
 * User: fqy
 * Date: 2021/9/1
 * Time: 19:57
 * Describe:
 */
public class AcwlTest {
    public static void main(String[] args) {
        AirConditionWithLock airConditionWithLock = new AirConditionWithLock();

        new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    airConditionWithLock.increament();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "t1").start();

        new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    airConditionWithLock.decreament();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "t2").start();

        new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    airConditionWithLock.increament();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "t3").start();

        new Thread(()->{
            for (int i = 0; i < 5; i++) {
                try {
                    airConditionWithLock.decreament();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "t4").start();

    }
}
